export default {
    namespaced: true,

    state: () => ({
        token: uni.getStorageSync('token') || '',
        userInfo: JSON.parse(uni.getStorageSync('userInfo') || '{}'),
        contractId: '',
        flowType:'F'
    }),
    mutations: {
        addToken(state, value) {
            state.token = value
        },
        updateUserInfo(state, userInfo) {
            state.userInfo = userInfo
            this.commit('m_user/saveUserInfoToStorage')
        },
        saveUserInfoToStorage(state) {
            uni.setStorageSync('userInfo', JSON.stringify(state.userInfo))
        },
        updateToken(state, token) {
            state.token = token
            this.commit('m_user/saveTokenToStorage')
        },
        saveTokenToStorage(state) {
            uni.setStorageSync('token', state.token)
        },
        updateContractId(state, contractId) {
            state.contractId = contractId
        },
        updateFlowType(state, flowType) {
            state.flowType = flowType
        }
    },
    getters: {}
}